package com.company.project.service.impl;

import com.company.project.dao.PeriodicalsExcellentMapper;
import com.company.project.model.PeriodicalsDbR;
import com.company.project.model.PeriodicalsExcellent;
import com.company.project.service.PeriodicalsExcellentService;
import com.company.project.core.AbstractService;
import com.company.project.util.PageUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * Created by CodeGenerator on 2018/10/10.
 */
@Service
@Transactional
public class PeriodicalsExcellentServiceImpl extends AbstractService<PeriodicalsExcellent> implements PeriodicalsExcellentService {
    @Resource
    private PeriodicalsExcellentMapper periodicalsExcellentMapper;
    
    //获取总条数
    @Override
    public Integer getAllCount() {
        return periodicalsExcellentMapper.selectAllCount();
    }

    //后台添加设置优秀期刊
    @Override
    public Integer adminAddPeriodicalsExcellent(PeriodicalsExcellent periodicalsExcellent) {
        return periodicalsExcellentMapper.insertSelective(periodicalsExcellent);
    }
    //后台修改优秀期刊
    @Override
    public Integer adminUpdatePeriodicalsExcellent(PeriodicalsExcellent periodicalsExcellent) {
        Example example = new Example(PeriodicalsExcellent.class);
        Example.Criteria criteria= example.createCriteria();
        criteria.andEqualTo("pid",periodicalsExcellent.getOldPid());
        return periodicalsExcellentMapper. updateByConditionSelective(periodicalsExcellent,example);
    }


    //后台根据pid删除
    @Override
    public Integer adminDelectByPid(Integer pid) {
        return periodicalsExcellentMapper.adminDelectByPid(pid);
    }



}
